package com.simon.jkxj.ui.conditioning;

import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.simon.jkxj.R;
import android.widget.LinearLayout;

public class HealthSelfTestResultActivity extends AppCompatActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_health_self_test_result);
        TextView tvScore = findViewById(R.id.tv_score);
        TextView tvResult = findViewById(R.id.tv_result);
        Button btnRestart = findViewById(R.id.btn_restart);
        TextView tvSummary = findViewById(R.id.tv_summary);

        int score = getIntent().getIntExtra("score", -1);
        if (score == -1) {
            score = 80 + (int)(Math.random()*20); // 80-99分
        }
        String suggestion;
        String summary;
        if (score >= 95) {
            suggestion = "您的健康状况非常好，请继续保持良好的生活习惯！\n建议：保持规律作息，适度锻炼，饮食均衡，定期体检。";
            summary = "总结：您的身体状态优异，生活方式值得肯定。请继续保持，预防为主。";
        } else if (score >= 85) {
            suggestion = "您的健康状况良好，暂无明显健康风险。\n建议：适当锻炼，注意饮食，避免熬夜，关注身体小变化。";
            summary = "总结：整体健康，但仍需注意生活细节，防微杜渐。";
        } else {
            suggestion = "您的健康状况一般，存在一定健康隐患。\n建议：建议及时关注身体变化，必要时就医，改善不良生活习惯。";
            summary = "总结：请重视身体信号，及时调整生活方式，必要时寻求专业帮助。";
        }
        tvScore.setText(String.valueOf(score));
        tvResult.setText(suggestion);
        tvSummary.setText(summary);
        btnRestart.setOnClickListener(v -> {
            finish(); // 返回自测页
        });
    }
} 